package chapter1;

import chapter1.operator.Operator;
import chapter1.operator.OperatorFactory;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class MAIN {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("输入四则运算符号:");
        String operator = reader.readLine();
        System.out.print("输入第一个运算数:");
        String operand1 = reader.readLine();
        System.out.print("输入第二个运算数:");
        String operand2 = reader.readLine();

        Operator operatorObj = OperatorFactory.createOperator(operator);
        System.out.println("最终运算结果为：" + operatorObj.getResult(Double.parseDouble(operand1), Double.parseDouble(operand2)));
    }
}
